source "$METIS_HOME"metis-plugin.config

_pluginName=`basename $0 | sed -r 's/.sh$//'`
_pluginOutputDirectory="${pluginDir}${_pluginName}/"
mkdir ${_pluginOutputDirectory}

URI_TO_IGNORE=/css/,/img/,/images/,/js/,/doc/

threads=10
timeout=1800

# Nikto for HTTP
query='select ipaddress,port from services where service = "http" and port !="443" and state = "open"'
cmd="${m_skipfish} -b i -I http://\${1}:\${2} -X ${URI_TO_IGNORE} -Z -o ${_pluginOutputDirectory}/\${1}_\${2} -M -Q -u -S ${m_skipfish_dict} -Y -R 5 -G 256 -l 3 -g 10 -m 10 -f 20 -t 60 -w 60 -i 60 -s 1024000"

"$pythonInterpreter" "$q2ex" -d "$database" -q "$query" -c "$cmd" -t "$threads" -T "$timeout" -o "$_pluginOutputDirectory" -e "$_pluginName" -L "$logginglevel" -O "$outputLog"

# Nikto for SSL 
query='select ipaddress,port from services where (port ="443" and state = "open") or (service = "https" and state = "open")'
cmd="${m_skipfish} -b i -I https://\${1}:\${2} -X ${URI_TO_IGNORE} -Z -o ${_pluginOutputDirectory}/\${1}_\${2} -M -Q -u -S ${m_skipfish_dict} -Y -R 5 -G 256 -l 3 -g 10 -m 10 -f 20 -t 60 -w 60 -i 60 -s 1024000"

"$pythonInterpreter" "$q2ex" -d "$database" -q "$query" -c "$cmd" -t "$threads" -T "$timeout" -o "$_pluginOutputDirectory" -e "$_pluginName" -L "$logginglevel" -O "$outputLog"
